#include "AddFriendDialog.h"
#include "ui_AddFriendDialog.h"

AddFriendDialog::AddFriendDialog(QWidget *parent) :
    QDialog(parent),
    m_ui(new Ui::AddFriendDialog)
{
    m_ui->setupUi(this);
}

AddFriendDialog::~AddFriendDialog()
{
    delete m_ui;
}

void AddFriendDialog::changeEvent(QEvent *e)
{
    QDialog::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        m_ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void AddFriendDialog::on_buttonBox_clicked(QAbstractButton* button)
{
    if( button->text() == "OK" && m_ui->leUsername->text().length() > 0 )
        emit addNewFriend(m_ui->leUsername->text(), m_ui->terMessage->toPlainText());
}
